package com.zhangxx.inventory;

import com.zhangxx.inventory.listener.InitListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

/**
 * @ClassName InventoryApplication
 * @Description 库存服务启动类
 * @Author leizhang
 * Date 2022/3/18 13:24
 * @Version 1.0
 **/
@SpringBootApplication
@ComponentScan(basePackages = {"com.zhangxx.common","com.zhangxx.inventory"})
public class InventoryApplication {
    public static void main(String[] args) {
        SpringApplication.run(InventoryApplication.class);
    }
    /**
     * @Description :注册监听器
     * @Author : leizhang
     * @Date 16:35 2022/3/18
     * @param
     * @return org.springframework.boot.web.servlet.ServletListenerRegistrationBean
     **/
    @Bean
    public ServletListenerRegistrationBean servletListenerRegistrationBean(){
        ServletListenerRegistrationBean servletListenerRegistrationBean =
                new ServletListenerRegistrationBean();
        servletListenerRegistrationBean.setListener(new InitListener());
        return servletListenerRegistrationBean;
    }
}
